package com.ruoyi.project.jiaqin.workshop.service.impl;

import java.util.List;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.jiaqin.workshop.mapper.CompanyWorkshopMapper;
import com.ruoyi.project.jiaqin.workshop.domain.CompanyWorkshop;
import com.ruoyi.project.jiaqin.workshop.service.ICompanyWorkshopService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 企业车间Service业务层处理
 *
 * @author admin
 * @date 2021-01-08
 */
@Service
public class CompanyWorkshopServiceImpl implements ICompanyWorkshopService
{
    @Autowired
    private CompanyWorkshopMapper companyWorkshopMapper;

    /**
     * 查询企业车间
     *
     * @param id 企业车间ID
     * @return 企业车间
     */
    @Override
    public CompanyWorkshop selectCompanyWorkshopById(String id)
    {
        return companyWorkshopMapper.selectCompanyWorkshopById(id);
    }

    /**
     * 查询企业车间列表
     *
     * @param companyWorkshop 企业车间
     * @return 企业车间
     */
    @Override
    public List<CompanyWorkshop> selectCompanyWorkshopList(CompanyWorkshop companyWorkshop)
    {
        return companyWorkshopMapper.selectCompanyWorkshopList(companyWorkshop);
    }

    /**
     * 新增企业车间
     *
     * @param companyWorkshop 企业车间
     * @return 结果
     */
    @Override
    public int insertCompanyWorkshop(CompanyWorkshop companyWorkshop)
    {
        companyWorkshop.setId(UUID.randomUUID().toString().replace("-",""));
        return companyWorkshopMapper.insertCompanyWorkshop(companyWorkshop);
    }

    /**
     * 修改企业车间
     *
     * @param companyWorkshop 企业车间
     * @return 结果
     */
    @Override
    public int updateCompanyWorkshop(CompanyWorkshop companyWorkshop)
    {
        return companyWorkshopMapper.updateCompanyWorkshop(companyWorkshop);
    }

    /**
     * 删除企业车间对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteCompanyWorkshopByIds(String ids)
    {
        return companyWorkshopMapper.deleteCompanyWorkshopByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除企业车间信息
     *
     * @param id 企业车间ID
     * @return 结果
     */
    @Override
    public int deleteCompanyWorkshopById(String id)
    {
        return companyWorkshopMapper.deleteCompanyWorkshopById(id);
    }
}
